<% if (site.customConfig.bgMusic === 'aplayer') { %>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.css">
  <script src="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.js"></script>
  <div class="aplayer" id="aplayer"></div>
  <script>
  let musics = JSON.parse('<%- JSON.stringify(site.customConfig.aplayerList) %>');
  let mediaMusic = [];
  for (let i = 0; i < musics.length; i++) {
    let item = musics[i];
    mediaMusic.push({
      name: item.musicName,
      artist: item.author,
      url: item.musicLink,
      lrc: item.lrc,
      cover: item.cover
    });
  }

  const ap = new APlayer({
      container: document.getElementById('aplayer'),
      fixed: true,
      lrcType: 3,
      listFolded: false,
      listMaxHeight: 90,
      audio: mediaMusic
  });
  window.addEventListener('load', function() {
    let postBody = document.querySelector('#post_body');
    let hs = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
    postBody && hs.forEach(h => {
      let helems = postBody.querySelectorAll(h);
      if (helems.length > 0) {
        helems.forEach(elem => {
          elem.id = encodeURI(elem.id);
        })
      }
    })
  })
  </script>
<% } else if (site.customConfig.bgMusic === 'Hkplayer') { %>
  <script src="https://myhkw.cn/api/player/162986644718" id="myhk" key="162986644718" m="1"></script>
<% } %>
